package duan.entity;

import duan.constant.RespConstant;

public class RespHelper {

    public static <T> ResultVO<T> success() {
        return success(null);
    }

    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<T>().setCode(RespConstant.SUCCESS_CODE).setMessage(RespConstant.SUCCESS_MSG).setData(data);
    }

    public static <T> ResultVO<T> error(String message) {
        return new ResultVO<T>().setCode(RespConstant.EXCEPTION_ERROR_CODE).setMessage(message);
    }

    public static <T> ResultVO<T> makeResp(int code, String message) {
        return makeResp(code, message, null);
    }

    public static <T> ResultVO<T> makeResp(int code, String message, T data) {
        return new ResultVO<T>().setCode(code).setMessage(message).setData(data);
    }
}
